#pragma once
#include "BaseType.h"
#include "Tracer.h"
#include "Singleton.h"
#include "Vehicle.h"
using namespace libemb;

class VehicleFactory{
DECL_CLASSNAME(VehicleFactory)
public:
    virtual std::shared_ptr<Car> createCar()=0;
    virtual std::shared_ptr<Plane> createPlane()=0;
};

//TeslaFactory
class TeslaFactory:public VehicleFactory,public Singleton<TeslaFactory>{
DECL_CLASSNAME(TeslaFactory)
DECL_SINGLETON(TeslaFactory)
public:
    //生产汽车
    std::shared_ptr<Car> createCar()
    {
        return std::make_shared<TeslaCar>();
    }
    //生产飞机
    std::shared_ptr<Plane> createPlane()
    {
        return std::make_shared<TeslaPlane>();
    }
};

TeslaFactory::TeslaFactory()
{
}

//Apple Factory
class AppleFactory:public VehicleFactory,public Singleton<AppleFactory>{
DECL_CLASSNAME(AppleFactory)
DECL_SINGLETON(AppleFactory)
public:
    //生产汽车
    std::shared_ptr<Car> createCar()
    {
        return std::make_shared<AppleCar>();
    }
    //生产飞机
    std::shared_ptr<Plane> createPlane()
    {
        return std::make_shared<ApplePlane>();
    }
};

AppleFactory::AppleFactory()
{
}